Skip to content

feat(android): add account support - #128

Merged
OffRange merged 65 commits into
v2from
feat/android/account
Nov 27, 2026
Merged

OffRange merged 65 commits into
v2from
feat/android/account

Conversation

@OffRange

Copy link
Copy Markdown
Owner

No description provided.

OffRange and others added 30 commits November 14, 2026 15:13
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Map OkHttp exceptions to typed Rust NetworkException kinds (unknown host,
timeout, refused, cleartext blocked, untrusted certificate, TLS) and expose
them as NetworkFailure on SyncError.Network. Add InvalidResponse and
UnexpectedStatus for answers that don't come from KeyGo, and log only
those unexpected failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Parse the entered address into a normalised origin and check it against
the server once typing pauses. A new address drops the previous result at
once, so Continue never proceeds with a server the field no longer shows.
Failures report a specific reason with a retry action, and whitespace is
stripped from pasted addresses instead of rejecting the edit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add a UsernameValidator binding that runs the shared keygo-api Username
check on-device and returns the normalized name. Reserved names surface
as their own error, which the server only reports as invalid_username.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Expose Username::normalize and is_allowed_char from keygo-api, and add
UsernameValidator.sanitize, which folds input the way validate does and
drops characters outside the alphabet, for use in text fields.

On the Kotlin side, validateWithResult returns a plain UsernameError
instead of the UniFFI exception, so callers can hold and compare it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Run the username field through the shared Rust sanitize, so full-width
and uppercase input lands as the stored name, and validate it while
typing. Errors appear inline once typing pauses; the helper lists the
allowed characters from the validator.

Continue now needs a valid name, and is read live so the invite field
enables it as soon as it is filled. The transformation is injected at
the screen, keeping the previewable content free of Koin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OffRange and others added 28 commits November 21, 2026 22:15
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds StepUpGate in core:sync: a call answered with fresh_auth_required
prompts for the password, steps up and retries once. Concurrent callers
share one prompt, and a session that ends abandons a pending step-up.
The app hosts the prompt dialog while the session is active.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A prompt abandoned with its session left the typed password in the
ViewModel while locked, and it filled the next prompt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The dialog is hosted app-wide by MainActivity and serves any step-up the
gate raises, so it belongs with StepUpGate and StepUpPrompter rather than
in feature:account. core:sync becomes a Compose module and depends on
core:ui for VisibilityButton.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CryptographicScope runs encrypt and decrypt on Dispatchers.Default, so
concurrent callers wrote the fake's plain map from several threads at
once. A dropped entry made its decrypt throw DecryptionFailed, which
failed "concurrent encrypt and decrypt succeeds" intermittently.

A 100,000-iteration stress run of that scenario failed 572 iterations
with the old map and none with ConcurrentHashMap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SetupPasswordField forwarded caller-supplied KeyboardOptions, which replace
Material's secure defaults, so the confirm and sign-in password fields got a
normal keyboard with autocorrect and suggestions. The field now builds the
options itself and only lets callers pick the IME action.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ess step

A refused username or invite was remembered without its server, so going
back, picking another server and typing the same name still showed it as
taken there and kept Continue disabled. The address can only change on
its step, so the rejection is dropped there. Going back from a password
step now also clears that password: nothing before its step reads it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A back swipe during a register or login previewed the previous step, but
the ViewModel refused to move, so nothing undid the preview and the screen
showed a step the wizard was not on. A busy step now takes the gesture
without moving. The handler stays on: turning it off would hand the back
to the nav host and close the whole wizard mid-request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
clearText() records the clear as one more undoable edit, and the dialog
reuses one TextFieldState for every prompt, so Ctrl+Z on a hardware
keyboard brought the last password back into the next prompt. The
step-up ViewModel now also clears the history, through a clearSecret()
moved to core:ui so it is shared with the account setup screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Login and register pass ServerAddress's origin (no trailing slash), while
every later call passes the stored session's URL, which Rust writes with
one. The cache compared them as text, so the first call after signing in
closed the client that had just signed in and built a new one: it lost
the access token and DPoP nonce, and after a failed token save it fell
back to a refresh token the server had already revoked. The cache now
trims the slash, and ServerAddress drops a scheme's default port the way
Rust's Url does, so both forms match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signing in or registering on server B tried to log out the stored session
through B's client. That client only reads sessions B issued, so A's
looked like no session: nothing was sent to A, the logout still cleared
the store, and A's session stayed valid with no token left on the device
to end it. The client now ends a session of another origin through a
client for that origin first. As before, this only happens once the new
session exists, so a failed login still keeps the previous one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The comment promised sync could always refresh without a prompt, but the
key, like every Keystore key here, sets setUnlockedDeviceRequired on API
28+, so signing fails while the device is locked. Nothing syncs in the
background yet; a TODO marks the policy for review once something does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ServerAddress kept only the scheme, host and port, so an address such as
example.com/keygo silently connected to example.com instead. It now
accepts an origin only, the same rule as Rust's check_base_url, and says
so: a path, query or fragment gets its own error asking for the address
without a path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On lock the screen cleared the passwords through clearPassword(), which
also reset both request checks to idle while a register or login could
still be running. Those checks are the only in-flight guard, so back and
Continue came back mid-request. A lock now clears only the secrets; the
running request resets its check when it lands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@OffRange
OffRange merged commit b6e0f38 into v2 Nov 27, 2026
8 checks passed
@OffRange
OffRange deleted the feat/android/account branch November 27, 2026 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant